//格式化时间年月日时分秒
let formatDate = (value,date = true) => {
    if (value) {
        var times = ''
        var d = new Date(value)
        // var times = d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate();
        var _year = check(d.getFullYear())
        var _month = check(d.getMonth() + 1)
        var _day = check(d.getDate())
        var _hour = check(d.getHours());
        var _mm = check(d.getMinutes());
        var _ss = check(d.getSeconds());

        if(date){
            times = _year + '-' + _month + '-' + _day + ' ' + _hour + ':' + _mm + ':' + _ss;
        }else{
            times = _year + '-' + _month + '-' + _day;
        }
        
      return times
    } else {
      return ""
    }
  
    function check(str) {
      str = str.toString();
      if (str.length < 2) {
        str = '0' + str;
      }
      return str;
    }
  }